var NumberUtil = {
	formatNum : function(prmNum, prmPtn, prmNullValue) {
		var nullValue = prmNullValue ? prmNullValue : 0;
		if (prmNum == "" || prmNum == null) {
			return nullValue;
		}
		prmNum = prmNum.replace(/\,/g, "");
		if (isNaN(prmNum)) {
			return nullValue;
		}
		if (prmPtn == "" || prmPtn == null) {
			return prmNum;
		}
		var ptnLen = prmPtn.length;
		var pointIndex = prmPtn.indexOf(".");
		var groupIndex = prmPtn.indexOf(",");
		var pointLen = (pointIndex == -1 ? 0 : ptnLen - pointIndex - 1);
		prmNum = parseFloat(prmNum).toFixed(pointLen) + "";
		if (groupIndex != -1) {
			if (pointIndex == -1) {
				pointIndex = ptnLen;
			}
			var len = pointIndex - groupIndex - 1;
			var reg = new RegExp("(-?\\d+)(\\d{" + len + "})");
			while (reg.test(prmNum)) {
				prmNum = prmNum.replace(reg, "$1,$2");
			}
		}
		return prmNum;
	},
	roundNum : function(num, n) {
		var dd = 1;
		var tempnum;
		for (i = 0; i < n; i++) {
			dd *= 10;
		}
		tempnum = num * dd;
		tempnum = Math.round(tempnum);
		return tempnum / dd;
	},
	displayNum : function(num, n) {
		var f = parseFloat(num);
		if (isNaN(f)) {
			return false;
		}
		var dd = 1;
		for (i = 0; i < n; i++) {
			dd *= 10;
		}
		var f = Math.round(num * dd) / dd;
		var s = f.toString();
		var rs = s.indexOf('.');
		if (rs < 0) {
			rs = s.length;
			s += '.';
		}
		while (s.length <= rs + n) {
			s += '0';
		}
		return s;
	},
	isNumber:function(value){
		return !isNaN(parseInt(value, 10));
	},
	displayString:function(num,length){
	    var numstr = num.toString();
	    var l=numstr.length;
	    if (numstr.length>=length) {return numstr;}
	    for(var  i = 0 ;i<length - l;i++){
	      numstr = "0" + numstr;  
	     }
	    return numstr; 
	   }
};
